package com.cxp.service.impl;

import com.cxp.entity.Projects;
import com.cxp.repository.ProjectRepository;
import com.cxp.service.ProjectsService;
import org.apache.commons.collections4.IteratorUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by cunxp on 2018/5/24.
 */
@Service("projectsService")
public class ProjectsServiceImpl implements ProjectsService{
    @Resource
    private ProjectRepository projectRepository;

    public Projects queryById(String id){
        return projectRepository.queryById(id);
    }

    @Override
    public List<Projects> listAll() {
        Iterable<Projects> iterables = projectRepository.findAll();
        List<Projects> list = IteratorUtils.toList(iterables.iterator());
        return list;
    }
}
